home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1995 January
/
1995-01b.d64
/
disk checker
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
5KB
|
198 lines
0 rem
90 print"[147][152]":poke53280,2:poke53281,15
92 print" disk checker
93 [153]" gives disk a good check for - start links
94 print" compares file length to dir file length
95 [153]" files overlapping actual blocks free
96 print" put disk to be checked in drive press <space> to check[152]
97 [161]g$:[139]g$[179][177]" "[167]97
100 [137]280
110 [143] inner trace loop
120 [152]1,"u1 2 0";t;s
130 [132]1,en,em$,et,es
140 [139]en[179][177]0[167]1960:[143] disk trace error
150 lt%(i)[178]lt%(i)[170]1
160 [139]ob%(t,s)[179][177]0[167]1410:[143] file intersect
170 ob%(t,s)[178]i
180 [161]#2,a$,b$
190 [139]a$[178]""[167]1450:[143] trace loop continue
200 [139]b$[178]""[167]b$[178][199](0)
210 t[178][198](a$):s[178][198](b$)
220 [137]120:[143] inner trace loop
230 [143]*******************************
240 [143]disk checker
250 [143]
260 [143]don fulton
270 [143]*******************************
280 [134]i,s,t,x,y,z
290 [134]bc,en,es,et,im,lc,of,pf,s1,s2,sf,t1,t2
300 [134]ts%(144),ss%(144),ld%(144),lt%(144),pf%(144),n$(144)
310 [134]ob%(35,20)
320 [160]1:[159]1,8,15:[160]2:[160]1
330 [143]-------------------------------
340 [153]"load"
350 [153]
360 [153]" disk checker
370 print" [163][163][163][163][163][163][163][163][163][163][163][163][163][163][163]
380 [153]" checks:
390 print
400 print" -- start links different
410 [153]
420 [153]" -- trace file len = dir file len
430 print
440 print" -- files do not overlap
450 [153]
460 [153]" -- blocks free
470 print
550 print" [207][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][208]
560 [153]" fnthis utility does not write to disk.then
570 print" [165] [167]
580 [153]" fn (problem files are displayed)wait then
590 print" [165] in inverse video)[146] [167]
600 [153]" (NULL)andandandandandandandandandandandandandandandandandandandandandandandandandandandandandandandandandandandandsqr
610 forx=1to1000:next
620 print
630 rem-------------------------------
640 rem find start of active files
650 print
660 print" start length "
670 print"file t , s file name dir--trace"
680 print"[163][163][163][163] [163][163][163][163][163] [163][163][163][163][163][163][163][163][163][163][163] [163][163][163] [163][163][163][163][163]"
690 open1,8,15
700 open2,8,2,"#"
710 t1=18:s1=1:i=1
720 rem next directory sector
730 :ift1=0then1010:rem directory close
740 :print#1,"u1 2 0";t1;s1
750 :input#1,en,em$,et,es
760 :ifen<>0then1980:rem disk error
770 :get#2,a$,b$
780 :t2=t1:s2=s1
790 :t1=asc(a$+chr$(0))
800 :s1=asc(b$+chr$(0))
810 :forx=2to255step32
820 :print#1,"u1 2 0";t2;s2
830 :print#1,"b-p 2";x
840 :input#1,en,em$,et,es
850 :ifen<>0then1980:rem disk error
860 :get#2,c$,d$,e$,f$,g$,h$,i$,j$,k$,l$,m$,n$,o$,p$,q$,r$,s$,t$,u$
870 :ifc$=""then980:rem directory continue
880 :ts%(i)=asc(d$+chr$(0))
890 :ss%(i)=asc(e$+chr$(0))
900 :n$(i)=f$+g$+h$+i$+j$+k$+l$+m$+n$+o$+p$+q$+r$+s$+t$+u$
910 :print#1,"b-p 2";x+28
920 :get#2,v$,w$
930 :ld%(i)=asc(v$+chr$(0))+256*asc(w$+chr$(0))
940 :printi;tab(4)ts%(i);tab(8)",";tab(9)ss%(i);
950 :printtab(13)n$(i);tab(29)ld%(i);tab(33);"--";lt%(i)
960 :i=i+1
970 :rem directory continue
980 :next
990 goto730:rem next directory sector
1000 rem directory close
1010 im=i-1
1020 close2:close1
1030 rem------------------------------
1040 print
1050 print" checking start links for overlap"
1060 print
1070 ifim=0orim=1then1250:rem start]link end
1080 fori=2toim
1090 :fory=1toi-1
1100 :ifts%(y)=ts%(i)thenifss%(y)=ss%(i)then1150:rem file overlap
1110 :next
1120 next
1130 goto1250:rem start linkend
1140 rem file overlap
1150 :pf%(i)=1:pf%(y)=1
1160 :of=1:rem set]overlap flag
1170 :printy;chr$(18);tab(4)ts%(y);tab(8)",";
1180 :printtab(9)ss%(y);tab(13)n$(y);chr$(146);
1190 :printtab(29)ld%(y);tab(33);"--";lt%(y)
1200 :printi;chr$(18);tab(4)ts%(i);tab(8)",";
1210 :printtab(9)ss%(i);tab(13)n$(i);chr$(146);
1220 :printtab(29)ld%(i);tab(33);"--";lt%(i)
1230 goto1110:rem start link continue
1240 rem start link end
1250 ifof=0thenprint" --start links ok--"
1260 rem-----------------------------
1270 print
1280 print" tracing files"
1290 print
1300 open1,8,15
1310 open2,8,2,"#"
1320 ifim=0then1530:rem trace end
1330 fori=1toim
1340 :t=ts%(i)
1350 :s=ss%(i)
1360 :lt%(i)=0
1370 :pf$=""
1380 :sf=0
1390 :goto120:rem inner trace loop
1400 :remfileintersect
1410 :pf%(ob%(t,s))=1
1420 :pf%(i)=1
1430 :sf=1:rem set intersect flag
1440 :rem trace loop continue
1450 :bc=bc+lt%(i)
1460 :printi;tab(4)ts%(i);tab(8)",";tab(9)ss%(i);
1470 :iflt%(i)<>ld%(i)thenpf%(i)=pf%(i)+2:print"[150]";:gosub2060
1480 :printtab(13)n$(i);tab(29)"[152]"ld%(i);tab(33);"--";lt%(i):gosub2050
1490 :ifpf$<>""thenprint" (file";i;"contains ";+pf$;")":print
1500 :ifsf=1thenprint" (file";i;"intersects file ";ob%(t,s);")":print
1510 next
1520 rem trace end
1530 close2:close1
1540 rem------------------------------
1550 print
1560 print" problem files--"
1570 print" [163][163][163][163][163][163][163][163][163][163][163][163][163]"
1580 ifim=0then1710:rem problem file end
1590 fori=1toim
1600 :ifpf%(i)=0then1690:rem problem loop continue
1610 :pf=1:rem set problem file flag
1620 :printi;
1630 :ifpf%(i)=1orpf%(i)=3thenprintchr$(18);
1640 :printtab(4)ts%(i);tab(8)",";tab(9)ss%(i);
1650 :printchr$(18);tab(13)n$(i);chr$(146);
1660 :ifpf%(i)=2orpf%(i)=3thenprintchr$(18);
1670 :printtab(29)ld%(i);tab(33);"--";lt%(i)
1680 :rem problem loop continue
1690 next
1700 rem problem file end
1710 ifpf=0thenprint" none"
1720 print
1730 print" block count = ";bc
1740 print
1750 print" blocks free = ";664-bc;tab(20)"(trace)"
1760 fori=0toim
1770 :lc=lc+ld%(i)
1780 next
1790 print" blocks free = ";664-lc;tab(20)"(dir)"
1800 rem------------------------------
1810 rem dir bam blocks free
1820 open1,8,15
1830 open2,8,2,"#"
1840 print#1,"u1 2 0";18;0
1850 input#1,en,em$,et,es
1860 ifen<>0then1980:rem disk error
1870 forx=0to35
1880 :get#2,w$,x$,y$,z$
1890 :ifx<>0andx<>18thenbu=bu+asc(w$+chr$(0))
1900 next
1910 print" blocks free = ";bu;tab(20)"(bam)"
1920 close2:close1
1930 end
1940 rem------------------------------
1950 rem disk trace error
1960 ifen=66thenpf$="illegal link":goto1450:rem trace loop continue
1970 rem disk error
1980 print
1990 print" unrecoverable disk error"
2000 print
2010 printen;em$;et;es
2020 close2:close1
2030 end
2050 fortu=20to0step-.9:poke54296,tu:poke54296,0:next:return
2060 fortu=78to0step-.9:poke54296,tu:poke54296,0:next:return